package com.xingzhengfan.eurekaclient;

import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.stereotype.Component;

@Component("mqConsumerListener")
public class MQConsumerListener {
    private static final Logger logger = LoggerFactory.getLogger(MQConsumerListener.class);

    public void financeConsumer(Object object) {
        Message message = (Message) object;
        String body = new String(message.getBody());
        JSONObject jsonObject = JSONObject.parseObject(body);
        String orderId = jsonObject.getString("orderId");
        logger.info("finance ===== orderId:{}", orderId);
    }
    public void orderConsumer(Object object) {
        Message message = (Message) object;
        String body = new String(message.getBody());
        JSONObject jsonObject = JSONObject.parseObject(body);
        String orderId = jsonObject.getString("orderId");
        logger.info("order ===== orderId:{}", orderId);
    }
}
